<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style>
	.Hunter-time-picker {
		width: 670px;
	}
</style>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
						<input id="id" name="id" th:value="${carPriceRule.id}"  type="hidden">
							<div class="form-group">
								<div class="container">
								<label class="col-sm-2 control-label">规则类型：</label>
								<div class="col-sm-9">
									<label class="radio-inline">
										<input disabled th:field="*{carPriceRule.type}" onclick="changeDiv(1)" name="type" type="radio"   value="1" />
										月租
									</label>
									<label class="radio-inline">
										<input disabled th:field="*{carPriceRule.type}" onclick="changeDiv(2)" type="radio"  name="type" value="2" />
										季租
									</label>
									<label class="radio-inline">
										<input disabled th:field="*{carPriceRule.type}" onclick="changeDiv(3)" type="radio"  name="type" value="3" />
										年租
									</label>
									<label class="radio-inline">
										<input disabled th:field="*{carPriceRule.type}" onclick="changeDiv(4)" type="radio"  name="type" value="4" />
										临时车
									</label>
								</div>
								</div>
							</div>
							<div>
                              <input th:value="${carPriceRule.type}"  type="hidden" id="typeInput"  name="typeInput"/>
                               <div id="fixedFeeDiv">
								<div class="form-group" >
								<div class="container">
									<label class="col-sm-2 control-label">金额（元）：</label>
									<div class="col-sm-9">
										<input id="amt" name="amt" th:value="${carPriceRule.amt}" class="form-control" type="text" placeholder="单位元">
									</div>
								</div>
							    </div>
								<div class="form-group">
									<div class="container">
										<label class="col-sm-2 control-label">规则名称：</label>
										<div class="col-sm-9">
											<input name="ruleName" th:value="${carPriceRule.ruleName}" maxlength="20"  class="form-control" type="text" placeholder="收费规则名称">
										</div>
									</div>
								</div>

								<div class="form-group">
									<div class="container">
										<div style="float:right;padding-right:15px">
										<button type="submit" class="btn btn-primary">保存并下发规则到绑定小区</button>
										</div>
									</div>
								</div>
							</div>
							</div>
							<div id="dyFeeDiv" style="display:none">
								<div class="form-group">
									<div class="container">
										<label class="col-sm-2 control-label">规则名称：</label>
										<div class="col-sm-9">
											<input id="ruleName"  th:value="${carPriceRule.ruleName}"   class="form-control" type="text" placeholder="收费规则名称">
										</div>
									</div>
								</div>
								<div class="form-group">
									<div class="container">
										<button  type="button"  onclick="addSegment()" class="btn btn-primary" style="margin-left:15px">添加时间段</button>
										<button  type="button"  onclick="clearAll()" class="btn btn-danger">全部清除</button>
									</div>
								</div>
								<div class="form-group" style="margin-left:0px;padding-right:20px">
									<div class="container">
										<table class="table table-striped" style="margin-top:-10px;">
											<thead>
											<tr>
												<th>时间区间</th>
												<th>开始</th>
												<th>结束</th>
												<th>收费（元）</th>
												<th >操作</th>
											</tr>
											</thead>
											<tbody id="t_body">
											    <tr th:each="seg,stat:${segList}">
													<td >
														【<span th:text="${seg.start}"></span>小时-<span th:text="${seg.end}"></span>小时】
													</td>
													<td th:text="${seg.start}"></td>
													<td th:text="${seg.end}"></td>
													<td th:if="${seg.cash} == '0.00'" th:text="免费"></td>
													<td th:if="${seg.cash} != '0.00'" th:text="${seg.cash}"></td>
													<td th:if="${stat.last}">
														<a class='btn btn-warning' href='javascript:;'  onclick='delOne(this)' title='删除'><i class='fa fa-remove'></i></a>
													</td>
													<td th:if="!${stat.last}">
														<a class='btn btn-warning' href='javascript:;'  style="display:none" onclick='delOne(this)' title='删除'><i class='fa fa-remove'></i></a>
													</td>
												</tr>
											</tbody>
										</table>
									</div>
								</div>

								<div class="form-group" style="margin-left:0px;padding-right:20px">
									<div class="container">
										<div style="float:right;">
											<button  type="button" id="dyFeeBtn" onclick="dyFeeBtnFun()" class="btn btn-primary">保存并下发规则到绑定小区</button>
										</div>
									</div>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
	</div>
	</div>

	<div class="modal fade" id="segModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
						&times;
					</button>
					<h4 class="modal-title">
						添加时间段
					</h4>
				</div>
				<div class="modal-body container">
					<div class="row" style="padding-top:0px;padding-bottom:10px;margin-top:-20px">
						<label class="col-sm-3 control-label" style="text-align:right;height:30px;line-height:30px"> 免费时长（分钟）：</label>
						<div class="col-sm-4" style="text-align:left">
							<input  id="freeMinInput"  class="form-control" onkeyup="checkMin()" type="text" th:value="${freeMin}"/>
						</div>
					</div>
					<div class="row" style="padding-top:5px;padding-bottom:5px">
						<label class="col-sm-3 control-label" style="text-align:right;height:30px;line-height:30px">  起始（小时）：</label>
						<div class="col-sm-4" style="text-align:left">
							<input  id="usSectionStartTime" readonly class="form-control" type="text" />
						</div>
					</div>
					<div class="row" style="padding-top:5px;padding-bottom:5px">
						<label class="col-sm-3 control-label" style="text-align:right;height:30px;line-height:30px"> 结束（小时）：</label>
						<div class="col-sm-4" style="text-align:left">
							<input  id="usSectionEndTime" readonly class="form-control" type="text"/>
						</div>
					</div>
					<div class="row" style="padding-top:5px;padding-bottom:5px">
						<label class="col-sm-3 control-label" style="text-align:right;height:30px;line-height:30px"> 收费金额（元）：</label>
						<div class="col-sm-4" style="text-align:left">
							<input  id="cashInput" type="input" max-length="6"  class="form-control" type="number"/>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" id="closeBtn" data-dismiss="modal">关闭</button>
					<button type="button" onclick="addSegBtn()" class="btn btn-primary">添加</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal -->

	<div th:include="include::footer"></div>
	<script type="text/javascript" src="/js/appjs/car/carPriceRule/edit.js">
	</script>
</body>
</html>
